<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>计算属性-2</title>
</head>
<body>
<div id="app">


    <div>
         message: <input type="text" v-model="message">

    </div>
    <div>
        first: <input type="text" v-model="emp.firstName">

    </div>

    <div>
        last: <input type="text" v-model="emp.lastName">

    </div>

    <div>
        {{emp.firstName}}.{{emp.lastName}}
    </div>

    <div>
        fullName:{{getFullName()}}
    </div>

    <div>

        fullName:{{fullName}}-调用次数：{{counter1}}
    </div>


</div>

</body>
<script src="../../lib/vue.global.js"></script>
<script>
    var app = Vue.createApp({
        data: function () {
            return {
                emp: {
                    firstName: 'Green',
                    lastName: 'Black'
                },counter1:0,
                message:'hello'
            }

    }
        ,methods:{
            getFullName:function (){
                return this.emp.firstName +"."+this.emp.lastName;
            }
        },
        computed:{
             fullName:function (){

                 this.counter1++;
                 return this.emp.firstName +"."+this.emp.lastName;
             }
        }
    })


    app.mount('#app');

</script>
</html>